//
//  PopularProductsCollectionViewCell.m
//  Beauty
//
//  Created by Snow on 16/8/31.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "PopularProductsCollectionViewCell.h"
#import "GXMacro.h"
@implementation PopularProductsCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _imageOfGoods = [[UIImageView alloc] init];
        [self.contentView addSubview:_imageOfGoods];
        _labelOfPrice = [[UILabel alloc] init];
        [self.contentView addSubview:_labelOfPrice];
        _labelOfName = [[UILabel alloc] init];
        [self.contentView addSubview:_labelOfName];
    }
    return self;
}
- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    [super applyLayoutAttributes:layoutAttributes];
    [_imageOfGoods mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.contentView.mas_top);
        make.left.mas_equalTo(self.contentView.mas_left);
        make.right.mas_equalTo(self.contentView.mas_right);
        make.height.mas_equalTo(self.contentView.mas_height).multipliedBy(0.8);
    }];
    [_labelOfName mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_imageOfGoods.mas_bottom);
        make.left.mas_equalTo(self.contentView.mas_left);
        make.right.mas_equalTo(self.contentView.mas_right);
        make.bottom.mas_equalTo(self.contentView.mas_bottom).mas_equalTo(-20);
    }];
    [_labelOfPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_labelOfName.mas_bottom);
        make.left.mas_equalTo(self.contentView.mas_left);
        make.right.mas_equalTo(self.contentView.mas_right);
        make.bottom.mas_equalTo(self.contentView.mas_bottom).mas_equalTo(-5);
    }];
    _imageOfGoods.image = [UIImage imageNamed:@"xborder_qisehua_a"];
    _labelOfName.text = @"3D-touch";
    _labelOfName.textAlignment = 1;
    _labelOfPrice.textAlignment = 1;
    _labelOfPrice.text = @"#127";
}

@end
